Commit 63bc8dcf authored by Robert Knight's avatar Robert Knight

Fix unpreview on exit. Attempt #2. Remove properties from the 'to unpreview'...

Fix unpreview on exit.  Attempt #2.  Remove properties from the 'to unpreview' list when saving changes.

svn path=/branches/work/konsole-split-view/; revision=661585
parent fe5f3716
......@@ -68,10 +68,25 @@ void EditProfileDialog::save()
return;
SessionManager::instance()->changeProfile(_profileKey,_tempProfile->setProperties());
// ensure that these settings are not undone by a call
// to unpreview()
QHashIterator<Profile::Property,QVariant> iter(_tempProfile->setProperties());
while ( iter.hasNext() )
{
iter.next();
_previewedProperties.remove(iter.key());
}
}
void EditProfileDialog::reject()
{
unpreviewAll();
KDialog::reject();
}
void EditProfileDialog::accept()
{
save();
unpreviewAll();
KDialog::accept();
}
void EditProfileDialog::setProfile(const QString& key)
......@@ -343,7 +358,7 @@ bool EditProfileDialog::eventFilter( QObject* watched , QEvent* event )
return KDialog::eventFilter(watched,event);
}
void EditProfileDialog::hideEvent(QHideEvent* event)
void EditProfileDialog::unpreviewAll()
{
qDebug() << "unpreviewing";
......@@ -352,19 +367,12 @@ void EditProfileDialog::hideEvent(QHideEvent* event)
while ( iter.hasNext() )
{
iter.next();
// only reset preview changes for temporary changes
// ( changes saved in _tempProfile are considered permanent )
if ( !_tempProfile->isPropertySet( (Profile::Property)iter.key() )
|| result() != QDialog::Accepted )
map.insert((Profile::Property)iter.key(),iter.value());
map.insert((Profile::Property)iter.key(),iter.value());
}
// undo any preview changes
if ( !_previewedProperties.isEmpty() )
if ( !map.isEmpty() )
SessionManager::instance()->changeProfile(_profileKey,map,false);
event->accept();
}
void EditProfileDialog::unpreview(int property)
{
......
......@@ -68,9 +68,9 @@ public:
public slots:
virtual void accept();
virtual void reject();
protected:
virtual void hideEvent(QHideEvent* event);
virtual bool eventFilter(QObject* watched , QEvent* event);
private slots:
......@@ -135,6 +135,7 @@ private slots:
void customCursorColorChanged(const QColor&);
void wordCharactersChanged(const QString&);
private:
// initialize various pages of the dialog
void setupGeneralPage(const Profile* info);
......@@ -153,6 +154,7 @@ private:
void preview(int property , QVariant value);
void unpreview(int property);
void unpreviewAll();
struct RadioOption
{
......
......@@ -140,7 +140,6 @@ KeyboardTranslatorReader::KeyboardTranslatorReader( QIODevice* source )
if ( !tokens.isEmpty() && tokens.first().type == Token::TitleKeyword )
{
qDebug() << "Found description: " << tokens[1].text;
_description = tokens[1].text;
}
}
......@@ -157,7 +156,6 @@ void KeyboardTranslatorReader::readNext()
{
KeyboardTranslator::State flags = KeyboardTranslator::NoState;
QKeySequence sequence = decodeSequence(tokens[1].text,flags);
qDebug() << sequence << ", count:" << sequence.count() << " text = " << tokens[1].text;
int keyCode = Qt::Key_unknown;
int modifiers = Qt::NoModifier;
......@@ -184,7 +182,6 @@ void KeyboardTranslatorReader::readNext()
// get text or command
if ( tokens[2].type == Token::OutputText )
{
qDebug() << "Setting text of length: " << tokens[2].text.length();
text = tokens[2].text.toLocal8Bit();
}
else if ( tokens[2].type == Token::Command )
......@@ -203,14 +200,11 @@ void KeyboardTranslatorReader::readNext()
else
qDebug() << "Command not understood:" << tokens[2].text;
qDebug() << "No text";
}
qDebug() << "About to create entry";
_nextEntry = KeyboardTranslator::Entry(keyCode,(Qt::KeyboardModifier)modifiers,flags,text,command);
qDebug() << "Created new entry";
_hasNext = true;
......@@ -283,9 +277,9 @@ QKeySequence KeyboardTranslatorReader::decodeSequence(const QString& text , Keyb
if ( modifiers & Qt::MetaModifier )
newText.prepend("meta+");
qDebug() << "modifier: " << newText;
//qDebug() << "modifier: " << newText;
sequence = QKeySequence::fromString(newText);
qDebug() << "after: " << sequence;
//qDebug() << "after: " << sequence;
stateFlags = (KeyboardTranslator::State)state;
......@@ -303,7 +297,6 @@ KeyboardTranslator::Entry KeyboardTranslatorReader::nextEntry()
{
Q_ASSERT( _hasNext );
qDebug() << "About to return entry";
KeyboardTranslator::Entry entry = _nextEntry;
......
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