diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp index 57345deae..7ca0b9656 100644 --- a/src/EditProfileDialog.cpp +++ b/src/EditProfileDialog.cpp @@ -82,8 +82,6 @@ EditProfileDialog::EditProfileDialog(QWidget* parent) SLOT(preparePage(int)) ); _tempProfile = new Profile; - - qDebug() << "Is modal = " << isModal(); } EditProfileDialog::~EditProfileDialog() { @@ -352,7 +350,6 @@ void EditProfileDialog::commandChanged(const QString& command) { ShellCommand shellCommand(command); - //TODO Split into command and arguments _tempProfile->setProperty(Profile::Command,shellCommand.command()); _tempProfile->setProperty(Profile::Arguments,shellCommand.arguments()); } @@ -376,13 +373,15 @@ void EditProfileDialog::setupAppearancePage(const Profile* info) connect( _colorSchemeAnimationTimeLine , SIGNAL(valueChanged(qreal)) , this , SLOT(colorSchemeAnimationUpdate()) ); + + _ui->transparencyWarningWidget->setVisible(false); // setup color list updateColorSchemeList(true); - _ui->colorSchemeList->setMouseTracking(true); _ui->colorSchemeList->installEventFilter(this); + _ui->colorSchemeList->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); connect( _ui->colorSchemeList->selectionModel() , SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)) @@ -442,8 +441,8 @@ void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme) item->setFlags( item->flags() ); if ( currentScheme == colors ) - selectedItem = item; - + selectedItem = item; + model->appendRow(item); } @@ -458,6 +457,9 @@ void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme) _ui->colorSchemeList->updateGeometry(); _ui->colorSchemeList->selectionModel()->setCurrentIndex( selectedItem->index() , QItemSelectionModel::Select ); + + // update transparency warning label + updateTransparencyWarning(); } } void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator) @@ -471,8 +473,6 @@ void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator) const KeyboardTranslator* currentTranslator = keyManager->findTranslator(name); - qDebug() << "Current translator = " << currentTranslator << ", name: " << name; - QStandardItemModel* model = new QStandardItemModel(this); QStandardItem* selectedItem = 0; @@ -485,11 +485,6 @@ void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator) const KeyboardTranslator* translator = keyManager->findTranslator(name); - qDebug() << "Translator:" << translator << ", name = " << - translator->name() << "description = " << - translator->description(); - - // TODO Use translator->description() here QStandardItem* item = new QStandardItem(translator->description()); item->setData(QVariant::fromValue(translator),Qt::UserRole+1); item->setIcon( KIcon("keyboard") ); @@ -525,8 +520,6 @@ bool EditProfileDialog::eventFilter( QObject* watched , QEvent* event ) } void EditProfileDialog::unpreviewAll() { - //qDebug() << "unpreviewing"; - QHash map; QHashIterator iter(_previewedProperties); while ( iter.hasNext() ) @@ -617,19 +610,9 @@ void EditProfileDialog::showColorSchemeEditor(bool isNewScheme) ColorSchemeManager::instance()->addColorScheme( newScheme ); - updateColorSchemeList(); + updateColorSchemeList(true); - const Profile* profile = lookupProfile(); - const QString& currentScheme = profile->colorScheme(); - - // the next couple of lines may seem slightly odd, - // but they force any open views based on the current profile - // to update their color schemes - if ( newScheme->name() == currentScheme ) - { - _tempProfile->setProperty(Profile::ColorScheme,newScheme->name()); - preview(Profile::ColorScheme,newScheme->name()); - } + preview(Profile::ColorScheme,newScheme->name()); } } void EditProfileDialog::newColorScheme() @@ -650,12 +633,24 @@ void EditProfileDialog::colorSchemeSelected() const ColorScheme* colors = model->data(selected.first(),Qt::UserRole+1).value(); _tempProfile->setProperty(Profile::ColorScheme,colors->name()); + + updateTransparencyWarning(); } } -void EditProfileDialog::setupKeyboardPage(const Profile* info) +void EditProfileDialog::updateTransparencyWarning() +{ + // zero or one indexes can be selected + foreach( const QModelIndex& index , _ui->colorSchemeList->selectionModel()->selectedIndexes() ) + { + bool hasTransparency = index.data(Qt::UserRole+1).value()->opacity() < 1.0; + + _ui->transparencyWarningWidget->setHidden(KWindowSystem::compositingActive() || !hasTransparency); + _ui->transparencyWarningIcon->setPixmap( KIcon("dialog-warning").pixmap(QSize(48,48)) ); + } +} +void EditProfileDialog::setupKeyboardPage(const Profile* /* info */) { // setup translator list - updateKeyBindingsList(true); connect( _ui->keyBindingList->selectionModel() , @@ -730,9 +725,6 @@ void EditProfileDialog::showKeyBindingEditor(bool isNewTranslator) if ( isNewTranslator ) newTranslator->setName(newTranslator->description()); - qDebug() << "Adding new or modified translator to manager" << - newTranslator->name() << ", " << newTranslator->description(); - KeyboardTranslatorManager::instance()->addTranslator( newTranslator ); updateKeyBindingsList(); @@ -931,7 +923,6 @@ void EditProfileDialog::toggleResizeWindow(bool enable) } void EditProfileDialog::fontSelected(const QFont& font) { - //qDebug() << "font selected"; QSlider* slider = _ui->fontSizeSlider; _ui->fontSizeSlider->setRange( qMin(slider->minimum(),font.pointSize()) , @@ -1108,29 +1099,4 @@ QSize ColorSchemeViewDelegate::sizeHint( const QStyleOptionViewItem& option, return QSize(width,(int)heightForWidth); } -/*bool ColorSchemeViewDelegate::editorEvent(QEvent* event,QAbstractItemModel* model, - const QStyleOptionViewItem& option, const QModelIndex& index) -{ - qDebug() << "event: " << event->type() << " at row " << index.row() << " column " << - index.column(); - return false; -}*/ - -KeyBindingViewDelegate::KeyBindingViewDelegate(QObject* parent) - : QAbstractItemDelegate(parent) -{ -} -void KeyBindingViewDelegate::paint(QPainter* /*painter*/, - const QStyleOptionViewItem& /*option*/, - const QModelIndex& /*index*/) const -{ -} -QSize KeyBindingViewDelegate::sizeHint( const QStyleOptionViewItem& /*option*/, - const QModelIndex& /*index*/) const -{ - // temporary - return QSize(100,100); -} - - #include "EditProfileDialog.moc" diff --git a/src/EditProfileDialog.h b/src/EditProfileDialog.h index 4a5927614..ccfa07ab9 100644 --- a/src/EditProfileDialog.h +++ b/src/EditProfileDialog.h @@ -188,6 +188,8 @@ private: void updateCaption(const QString& profileName); + void updateTransparencyWarning(); + struct RadioOption { QAbstractButton* button; @@ -248,27 +250,6 @@ public: private: QPointer _entryTimeLine; - // virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, - // const QModelIndex& index) const; - // virtual bool editorEvent(QEvent* event,QAbstractItemModel* model, - // const QStyleOptionViewItem& option, const QModelIndex& index); - -}; - -/** - * A delegate which can display and edit key bindings in a view. - */ -class KeyBindingViewDelegate : public QAbstractItemDelegate -{ -public: - KeyBindingViewDelegate(QObject* parent = 0); - - // reimplemented - virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, - const QModelIndex& index) const; - virtual QSize sizeHint( const QStyleOptionViewItem& option, - const QModelIndex& index) const; - }; } diff --git a/src/EditProfileDialog.ui b/src/EditProfileDialog.ui index 6e2b7df37..5ae905dce 100644 --- a/src/EditProfileDialog.ui +++ b/src/EditProfileDialog.ui @@ -6,7 +6,7 @@ 0 0 441 - 505 + 485 @@ -362,7 +362,7 @@ 20 - 40 + 10 @@ -443,12 +443,59 @@ - 75 - 201 + 20 + 20 + + + + false + + + * { background-color: #FFCCCC ; border-radius: 3px } + + + + 4 + + + 4 + + + 4 + + + 4 + + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + This colour scheme has a transparent background which does not appear to be supported on your desktop. + + + true + + + + + + @@ -612,7 +659,7 @@ - 40 + 20 20 @@ -707,7 +754,7 @@ 20 - 40 + 20 @@ -795,8 +842,8 @@ - 71 - 101 + 20 + 20 diff --git a/src/Emulation.cpp b/src/Emulation.cpp index 9adbc7206..a737488bd 100644 --- a/src/Emulation.cpp +++ b/src/Emulation.cpp @@ -183,9 +183,9 @@ void Emulation::setCodec(EmulationCodec codec) setCodec( QTextCodec::codecForLocale() ); } -void Emulation::setKeyBindings(const QString &id) +void Emulation::setKeyBindings(const QString& name) { - _keyTranslator = KeyboardTranslatorManager::instance()->findTranslator(id); + _keyTranslator = KeyboardTranslatorManager::instance()->findTranslator(name); } QString Emulation::keyBindings() diff --git a/src/Emulation.h b/src/Emulation.h index e5aeb325c..75d7d64b6 100644 --- a/src/Emulation.h +++ b/src/Emulation.h @@ -88,7 +88,7 @@ enum * output. Each screen window covers the same number of lines and columns as the * image size returned by imageSize(). The screen window can be moved up and down * and provides transparent access to both the current on-screen image and the - * previous output. The screen windows emit and outputChanged signal + * previous output. The screen windows emit an outputChanged signal * when the section of the image they are looking at changes. * Graphical views can then render the contents of a screen window, listening for notifications * of output changes from the screen window which they are associated with and updating @@ -191,9 +191,9 @@ public: * ( received through sendKeyEvent() ) into character * streams to send to the terminal. */ - void setKeyBindings(const QString &id); + void setKeyBindings(const QString& name); /** - * Returns the emulation's current key bindings. + * Returns the name of the emulation's current key bindings. * See setKeyBindings() */ QString keyBindings(); @@ -222,19 +222,19 @@ public slots: /** * Interprets a sequence of characters and sends the result to the terminal. - * This is equivalent to calling onKeyPress for each character in @p text in succession. + * This is equivalent to calling sendKeyEvent() for each character in @p text in succession. */ virtual void sendText(const QString& text) = 0; /** - * Interprets a key press event and emits the sendString() signal with + * Interprets a key press event and emits the sendData() signal with * the resulting character stream. */ virtual void sendKeyEvent(QKeyEvent*); /** * Converts information about a mouse event into an xterm-compatible escape - * sequence and emits the character sequence via sendString() + * sequence and emits the character sequence via sendData() */ virtual void sendMouseEvent(int buttons, int column, int line, int eventType); @@ -247,8 +247,19 @@ public slots: */ virtual void sendString(const char* string, int length = -1) = 0; - /** Processes an incoming block of text. */ - void receiveData(const char* txt,int len); + /** + * Processes an incoming stream of characters. receiveData() decodes the incoming + * character buffer using the current codec(), and then calls receiveChar() for + * each unicode character in the resulting buffer. + * + * receiveData() also starts a timer which causes the outputChanged() signal + * to be emitted when it expires. The timer allows multiple updates in quick + * succession to be buffered into a single outputChanged() signal emission. + * + * @param buffer A string of characters received from the terminal program. + * @param len The length of @p buffer + */ + void receiveData(const char* buffer,int len); signals: @@ -339,18 +350,21 @@ signals: * the user-title of the session. * * @param title Specifies what to change. - * 0 - Set window icon text and session title to @p newTitle - * 1 - Set window icon text to @p newTitle - * 2 - Set session title to @p newTitle - * 11 - Set the session's default background color to @p newTitle, + *
    + *
  • 0 - Set window icon text and session title to @p newTitle
  • + *
  • 1 - Set window icon text to @p newTitle
  • + *
  • 2 - Set session title to @p newTitle
  • + *
  • 11 - Set the session's default background color to @p newTitle, * where @p newTitle can be an HTML-style string (#RRGGBB) or a named * color (eg 'red', 'blue'). * See http://doc.trolltech.com/4.2/qcolor.html#setNamedColor for more * details. - * 31 - Supposedly treats @p newTitle as a URL and opens it (NOT IMPLEMENTED) - * 32 - Sets the icon associated with the session. @p newTitle is the name + *
  • + *
  • 31 - Supposedly treats @p newTitle as a URL and opens it (NOT IMPLEMENTED)
  • + *
  • 32 - Sets the icon associated with the session. @p newTitle is the name * of the icon to use, which can be the name of any icon in the current KDE icon - * theme (eg: 'konsole', 'kate', 'folder_home') + * theme (eg: 'konsole', 'kate', 'folder_home')
  • + *
* @param newTitle Specifies the new title */ @@ -363,10 +377,15 @@ signals: void imageSizeChanged(int lineCount , int columnCount); /** - * Emitted when the terminal program emits a profile change - * command sequence + * Emitted when the terminal program requests to change various properties + * of the terminal display. * - * @param text The text of the command + * A profile change command occurs when a special escape sequence, followed + * by a string containing a series of name and value pairs is received. + * This string can be parsed using a ProfileCommandParser instance. + * + * @param text A string expected to contain a series of key and value pairs in + * the form: name=value;name2=value2 ... */ void profileChangeCommandReceived(const QString& text); @@ -375,13 +394,15 @@ protected: virtual void resetMode(int mode) = 0; /** - * Processes an incoming character. See onReceiveBlock() + * Processes an incoming character. See receiveData() * @p ch A unicode character code. */ virtual void receiveChar(int ch); /** - * Sets the active screen + * Sets the active screen. The terminal has two screens, primary and alternate. + * The primary screen is used by default. When certain interactive programs such + * as Vim are run, they trigger a switch to the alternate screen. * * @param index 0 to switch to the primary screen, or 1 to switch to the alternate screen */ diff --git a/src/Filter.cpp b/src/Filter.cpp index 5af718932..27b529c6c 100644 --- a/src/Filter.cpp +++ b/src/Filter.cpp @@ -431,9 +431,9 @@ QString UrlFilter::HotSpot::tooltip() const const UrlType kind = urlType(); if ( kind == StandardUrl ) - return i18n("Click to open '%1' in your browser.",url); + return i18n("Click to open %1 in your browser.",url); else if ( kind == Email ) - return i18n("Click to send an email to '%1'.",url); + return i18n("Click to send an email to %1.",url); else return QString(); } diff --git a/src/KeyboardTranslator.cpp b/src/KeyboardTranslator.cpp index fdedd2689..a7a641314 100644 --- a/src/KeyboardTranslator.cpp +++ b/src/KeyboardTranslator.cpp @@ -282,11 +282,6 @@ void KeyboardTranslatorReader::readNext() _nextEntry = newEntry; - //qDebug() << "Any modifier state: " << (int)(flags & KeyboardTranslator::AnyModifierState); - //qDebug() << "Any modifier mask: " << (int)(flagMask & KeyboardTranslator::AnyModifierState); - - // qDebug() << "Parsed entry:" << _nextEntry.conditionToString(); - _hasNext = true; return; @@ -312,8 +307,6 @@ bool KeyboardTranslatorReader::decodeSequence(const QString& text, KeyboardTranslator::States tempFlags = flags; KeyboardTranslator::States tempFlagMask = flagMask; - // qDebug() << "Input text:" << text; - for ( int i = 0 ; i < text.count() ; i++ ) { const QChar& ch = text[i]; @@ -341,16 +334,6 @@ bool KeyboardTranslatorReader::decodeSequence(const QString& text, } else if ( parseAsStateFlag(buffer,itemFlag) ) { -#if 0 - if ( itemFlag == KeyboardTranslator::AnyModifierState ) - { - qDebug() << "Flag mask: " << (int)(tempFlagMask & KeyboardTranslator::AnyModifierState); - qDebug() << "Flags: " << (int)(tempFlags & KeyboardTranslator::AnyModifierState); - - qDebug() << "Wanted: " << isWanted; - } -#endif - tempFlagMask |= itemFlag; if ( isWanted ) @@ -435,80 +418,6 @@ bool KeyboardTranslatorReader::parseAsKeyCode(const QString& item , int& keyCode return true; } -#if 0 -QKeySequence KeyboardTranslatorReader::decodeSequence(const QString& text , KeyboardTranslator::State& stateFlags ) -{ - int state = KeyboardTranslator::NoState; - stateFlags = (KeyboardTranslator::State)state; - - QKeySequence sequence = QKeySequence::fromString(text); - - if ( sequence.count() > 0 ) - return sequence; - - // if the sequence is empty, it failed to decode properly - // this can happen if the file was produced by a KDE 3 version - // of Konsole - // - // possible reasons: - // - Key sequence includes names not known to Qt - // ( eg "Ansi" , "NewLine" ) - // - Key sequence has modifiers at the end of the line ( eg "F10+Shift" ) - // instead of at the start, which QKeySequence requires - // - Use of '-' in front of modifiers to indicate that they are - // not required - - int modifiers = Qt::NoModifier; - - // first pass - // rearrange modifers and try decoding again - if ( text.contains("+shift",Qt::CaseInsensitive) ) - modifiers |= Qt::ShiftModifier; - if ( text.contains("+ctrl",Qt::CaseInsensitive) ) - modifiers |= Qt::ControlModifier; - if ( text.contains("+control",Qt::CaseInsensitive) ) - modifiers |= Qt::ControlModifier; - if ( text.contains("+alt",Qt::CaseInsensitive) ) - modifiers |= Qt::AltModifier; - if ( text.contains("+meta",Qt::CaseInsensitive) ) - modifiers |= Qt::MetaModifier; - if ( text.contains("+ansi",Qt::CaseInsensitive) ) - state |= KeyboardTranslator::AnsiState; - if ( text.contains("+appcukeys",Qt::CaseInsensitive) ) - state |= KeyboardTranslator::CursorKeysState; - if ( text.contains("+newline",Qt::CaseInsensitive) ) - state |= KeyboardTranslator::NewLineState; - - static QRegExp modifierRemover("((\\+|\\-)shift|" - "(\\+|\\-)ctrl|" - "(\\+|\\-)control|" - "(\\+|\\-)alt|" - "(\\+|\\-)ansi|" - "(\\+|\\-)appcukeys|" - "(\\+|\\-)newline|" - "(\\+|\\-)meta)",Qt::CaseInsensitive); - QString newText(text); - newText.replace(modifierRemover,QString()); - - if ( modifiers & Qt::ShiftModifier ) - newText.prepend("shift+"); - if ( modifiers & Qt::ControlModifier ) - newText.prepend("ctrl+"); - if ( modifiers & Qt::AltModifier ) - newText.prepend("alt+"); - if ( modifiers & Qt::MetaModifier ) - newText.prepend("meta+"); - - //qDebug() << "modifier: " << newText; - sequence = QKeySequence::fromString(newText); - //qDebug() << "after: " << sequence; - - stateFlags = (KeyboardTranslator::State)state; - - return sequence; -} -#endif - QString KeyboardTranslatorReader::description() const { return _description; @@ -572,11 +481,8 @@ QList KeyboardTranslatorReader::tokenize(const QList list; - // qDebug() << "line: " << text; - if ( text.isEmpty() || comment.exactMatch(text) ) { - // qDebug() << "This is a comment"; return list; } @@ -635,24 +541,6 @@ KeyboardTranslator::Entry::Entry() { } -#if 0 -QKeySequence KeyboardTranslator::Entry::keySequence() const -{ - int code = _keyCode; - - if ( _modifiers & Qt::AltModifier ) - code += Qt::ALT; - if ( _modifiers & Qt::ControlModifier ) - code += Qt::CTRL; - if ( _modifiers & Qt::ShiftModifier ) - code += Qt::SHIFT; - if ( _modifiers & Qt::MetaModifier ) - code += Qt::META; - - return QKeySequence(code); -} -#endif - bool KeyboardTranslator::Entry::operator==(const Entry& rhs) const { return _keyCode == rhs._keyCode && @@ -668,20 +556,12 @@ bool KeyboardTranslator::Entry::matches(int keyCode , Qt::KeyboardModifiers modifiers, States state) const { - - //qDebug() << "Checking for match" << conditionToString(); - //qDebug() << "Checking entry. test key code = " << keyCode << " entry key code =" << _keyCode; - if ( _keyCode != keyCode ) return false; - //qDebug() << "Checking modifiers"; - if ( (modifiers & _modifierMask) != (_modifiers & _modifierMask) ) return false; - //qDebug() << "Checking state"; - // if modifiers is non-zero, the 'any modifier' state is implicit if ( modifiers != 0 ) state |= AnyModifierState; @@ -689,8 +569,6 @@ bool KeyboardTranslator::Entry::matches(int keyCode , if ( (state & _stateMask) != (_state & _stateMask) ) return false; - //qDebug() << "Checking any mod state"; - // special handling for the 'Any Modifier' state, which checks for the presence of // any or no modifiers if ( _stateMask & KeyboardTranslator::AnyModifierState ) @@ -704,8 +582,6 @@ bool KeyboardTranslator::Entry::matches(int keyCode , return false; } - //qDebug() << "Entry matches" << conditionToString(); - return true; } QByteArray KeyboardTranslator::Entry::escapedText() const @@ -790,11 +666,7 @@ QByteArray KeyboardTranslator::Entry::unescape(const QByteArray& input) const result.replace(i,charsToRemove,replacement); } } - - //qDebug() << "Unescaped" << input; - //for ( int i = 0 ; i < result.count() ; i++ ) - // qDebug() << (int)result[i] << ";" << result[i]; - + return result; } @@ -880,16 +752,6 @@ KeyboardTranslator::KeyboardTranslator(const QString& name) { } -#if 0 -KeyboardTranslator::KeyboardTranslator(const KeyboardTranslator& other) -: _name(other._name) -{ - _description = other._description; - - // TODO: Copy keyboard entries -} -#endif - void KeyboardTranslator::setDescription(const QString& description) { _description = description; @@ -929,17 +791,10 @@ void KeyboardTranslator::removeEntry(const Entry& entry) } KeyboardTranslator::Entry KeyboardTranslator::findEntry(int keyCode, Qt::KeyboardModifiers modifiers, States state) const { -// qDebug() << "Searching for entry for key code =" << keyCode << ", modifiers =" << modifiers; -// printf("modifiers in hex %x\n",(int)modifiers); - - //qDebug() << "Translator keys, count: " << _entries.count() << _entries.keys(); - if ( _entries.contains(keyCode) ) { QList entriesForKey = _entries.values(keyCode); - //qDebug() << "Found" << entriesForKey.count() << "matches for key code" << keyCode; - QListIterator iter(entriesForKey); while (iter.hasNext()) @@ -947,8 +802,6 @@ KeyboardTranslator::Entry KeyboardTranslator::findEntry(int keyCode, Qt::Keyboar const Entry& next = iter.next(); if ( next.matches(keyCode,modifiers,state) ) return next; - - //qDebug() << "Entry" << next.resultToString() << "did not match."; } return Entry(); // entry not found diff --git a/src/KeyboardTranslator.h b/src/KeyboardTranslator.h index db1c0e402..ff52cc115 100644 --- a/src/KeyboardTranslator.h +++ b/src/KeyboardTranslator.h @@ -141,7 +141,7 @@ public: * Returns the character sequence associated with this entry, * with any non-printable characters replaced with escape sequences. * - * eg. \E for Escape, \t for tab, \n for new line. + * eg. \\E for Escape, \\t for tab, \\n for new line. */ QByteArray escapedText() const; @@ -151,7 +151,7 @@ public: void setKeyCode(int keyCode); /** - * Returns the a bitwise-OR of the enabled keyboard modifiers associated with this entry. + * Returns a bitwise-OR of the enabled keyboard modifiers associated with this entry. * If a modifier is set in modifierMask() but not in modifiers(), this means that the entry * only matches when that modifier is NOT pressed. * diff --git a/src/ManageProfilesDialog.cpp b/src/ManageProfilesDialog.cpp index ebc011c71..e90a6e6a2 100644 --- a/src/ManageProfilesDialog.cpp +++ b/src/ManageProfilesDialog.cpp @@ -74,7 +74,7 @@ ManageProfilesDialog::ManageProfilesDialog(QWidget* parent) } -void ManageProfilesDialog::showEvent(QShowEvent* event) +void ManageProfilesDialog::showEvent(QShowEvent*) { Q_ASSERT( _ui->sessionTable->model() ); @@ -296,7 +296,7 @@ ProfileItemDelegate::ProfileItemDelegate(QObject* parent) : QItemDelegate(parent) { } -bool ProfileItemDelegate::editorEvent(QEvent* event,QAbstractItemModel* model, +bool ProfileItemDelegate::editorEvent(QEvent* event,QAbstractItemModel*, const QStyleOptionViewItem&,const QModelIndex& index) { if ( event->type() == QEvent::MouseButtonPress || event->type() == QEvent::KeyPress ) diff --git a/src/SessionManager.cpp b/src/SessionManager.cpp index 681c70dd7..bb573ff58 100644 --- a/src/SessionManager.cpp +++ b/src/SessionManager.cpp @@ -191,6 +191,9 @@ SessionManager::~SessionManager() // save shortcuts saveShortcuts(); + // save favorites + saveFavorites(); + // delete remaining sessions foreach( Session* session , _sessions ) { @@ -296,7 +299,7 @@ QString SessionManager::defaultProfileKey() const return _defaultProfile; } -void SessionManager::saveProfile(const QString& path , Profile* info) +QString SessionManager::saveProfile(const QString& path , Profile* info) { ProfileWriter* writer = new KDE4ProfileWriter; @@ -308,6 +311,8 @@ void SessionManager::saveProfile(const QString& path , Profile* info) writer->writeProfile(newPath,info); delete writer; + + return newPath; } void SessionManager::changeProfile(const QString& key , @@ -347,12 +352,12 @@ void SessionManager::changeProfile(const QString& key , if ( info->isPropertySet(Profile::Path) ) { qDebug() << "Profile saved to existing path: " << info->path(); - saveProfile(info->path(),info); + info->setProperty(Profile::Path,saveProfile(info->path(),info)); } else { qDebug() << "Profile saved to new path."; - saveProfile(QString(),info); + info->setProperty(Profile::Path,saveProfile(QString(),info)); } } } @@ -445,11 +450,14 @@ QString SessionManager::addProfile(Profile* type) { QString key; + // choose a key for the Profile for ( int counter = 0;;counter++ ) { - if ( !_types.contains(type->path() + QString::number(counter)) ) + //if ( !_types.contains(type->path() + QString::number(counter)) ) + + if ( !_types.contains(type->name() + QString::number(counter)) ) { - key = type->path() + QString::number(counter); + key = type->name() + QString::number(counter); break; } } @@ -536,16 +544,12 @@ void SessionManager::setFavorite(const QString& key , bool favorite) _favorites.insert(key); emit favoriteStatusChanged(key,favorite); - - saveFavorites(); } else if ( !favorite && _favorites.contains(key) ) { qDebug() << "removing favorite - " << key; _favorites.remove(key); emit favoriteStatusChanged(key,favorite); - - saveFavorites(); } } diff --git a/src/SessionManager.h b/src/SessionManager.h index ea9664b03..2599099f5 100644 --- a/src/SessionManager.h +++ b/src/SessionManager.h @@ -288,8 +288,11 @@ private: void loadFavorites(); //saves the set of favorite sessions void saveFavorites(); - // saves a profile to a file - void saveProfile(const QString& path , Profile* profile); + // saves a profile to a file + // returns the path to which the profile was saved, which will + // be the same as the 'path' argument if valid or a newly generated path + // otherwise + QString saveProfile(const QString& path , Profile* profile); // applies updates to the profile associated with @p key // to all sessions currently using that profile diff --git a/src/ShellCommand.cpp b/src/ShellCommand.cpp index bab8ad5b9..d432774a0 100644 --- a/src/ShellCommand.cpp +++ b/src/ShellCommand.cpp @@ -56,8 +56,6 @@ ShellCommand::ShellCommand(const QString& fullCommand) } } } - - //qDebug() << "Arguments:" << _arguments; } ShellCommand::ShellCommand(const QString& command , const QStringList& arguments) { @@ -110,13 +108,11 @@ QString ShellCommand::expand(const QString& text) /* * expandEnv * - * Expand environment variables in text. Escaped '$' are ignored. - * Return true if expansion was made. + * Expand environment variables in text. Escaped '$' characters are ignored. + * Return true if any variables were expanded */ static bool expandEnv( QString &text ) { - qDebug() << "Expanding text: " << text; - // Find all environment variables beginning with '$' // int pos = 0; @@ -165,7 +161,5 @@ static bool expandEnv( QString &text ) } } - qDebug() << "Expanded to" << text; - return expanded; } diff --git a/src/TerminalDisplay.h b/src/TerminalDisplay.h index b865d278e..2b0dfa424 100644 --- a/src/TerminalDisplay.h +++ b/src/TerminalDisplay.h @@ -698,11 +698,19 @@ private: QAction* _mvAction; QAction* _lnAction; + // list of filters currently applied to the display. used for links and + // search highlight TerminalImageFilterChain* _filterChain; QRect _mouseOverHotspotArea; KeyboardCursorShape _cursorShape; - QColor _cursorColor; + + // custom cursor color. if this is invalid then the foreground + // color of the character under the cursor is used + QColor _cursorColor; + + // set to true when keyboard-based text selection is active + bool _keyboardTextSelectionActive; //the delay in milliseconds between redrawing blinking text static const int BLINK_DELAY = 500;