[Konversation-devel] [Bug 213370] Channel Settings dialog fails to refresh topic information upon subsequent openings
Eike Hein
hein at kde.org
Thu Jul 1 16:19:49 CEST 2010
https://bugs.kde.org/show_bug.cgi?id=213370
--- Comment #3 from Eike Hein <hein kde org> 2010-07-01 16:19:47 ---
commit 59311d2101064ab86611d72d94844dbb25f74e96
Author: Eike Hein <hein at kde.org>
Date: Sat Nov 7 02:29:31 2009 +0000
* Making and then comitting unrelated changes in the Channel Settings
dialog could cause unintentionally setting the channel's topic to an
older version if someone else had changed the topic since the first
time the dialog was opened or while the dialog was open, due to a bug
in the code that avoids such external topic changes interfering with
concurrent local editing of the topic. This has been fixed.
* The contents of the topic edit field in the Channel Settings dialog
will now reflect the selected item in the topic history list until
the user starts editing.
(Ended up abusing QTextEdit::undoAvailable() to get something akin to
QLineEdit::textEdited() for QTextEdit, and QTextEdit::clear() to flush
the undo history at dialog close to kick the selection->textedit sync
back into gear for the next dialog open.)
BUG:213370
svn path=/trunk/extragear/network/konversation/; revision=1045997
diff --git a/ChangeLog b/ChangeLog
index c25aee4..166c1f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,6 +30,15 @@ Changes since 1.2:
the "Downloads paths" configured in System Settings or the equivalent
in other desktop environments (under the hood, this is a shared XDG
setting).
+* Making and then comitting unrelated changes in the Channel Settings
+ dialog could cause unintentionally setting the channel's topic to an
+ older version if someone else had changed the topic since the first
+ time the dialog was opened or while the dialog was open, due to a bug
+ in the code that avoids such external topic changes interfering with
+ concurrent local editing of the topic. This has been fixed.
+* The contents of the topic edit field in the Channel Settings dialog
+ will now reflect the selected item in the topic history list until
+ the user starts editing.
Changes from 1.2-rc1 to 1.2:
diff --git a/src/irc/channeloptionsdialog.cpp
b/src/irc/channeloptionsdialog.cpp
index 68b19f2..4fc7a26 100644
--- a/src/irc/channeloptionsdialog.cpp
+++ b/src/irc/channeloptionsdialog.cpp
@@ -54,7 +54,8 @@ namespace Konversation
connect(m_ui.topicHistoryView->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
this, SLOT(topicHistoryItemClicked(const QItemSelection&)));
connect(m_ui.toggleAdvancedModes, SIGNAL(clicked()), this,
SLOT(toggleAdvancedModes()));
- connect(m_ui.topicEdit, SIGNAL(textChanged()), this,
SLOT(topicBeingEdited()));
+ connect(m_ui.topicEdit, SIGNAL(undoAvailable(bool)), this,
SLOT(topicBeingEdited(bool)));
+ connect(this, SIGNAL(finished()), m_ui.topicEdit, SLOT(clear()));
connect(m_channel, SIGNAL(topicHistoryChanged()), this,
SLOT(refreshTopicHistory()));
@@ -159,9 +160,9 @@ namespace Konversation
}
}
- void ChannelOptionsDialog::topicBeingEdited()
+ void ChannelOptionsDialog::topicBeingEdited(bool edited)
{
- m_editingTopic = true;
+ m_editingTopic = edited;
}
QString ChannelOptionsDialog::topic()
@@ -190,22 +191,25 @@ namespace Konversation
// update topic preview
QItemSelection selection(m_topicModel->index(0, 0, QModelIndex()),
m_topicModel->index(0, 1, QModelIndex()));
m_ui.topicHistoryView->selectionModel()->select(selection,
QItemSelectionModel::ClearAndSelect);
- // don't destroy the user's edit box if they started editing
- if(!m_editingTopic && !history.isEmpty())
- m_ui.topicEdit->setText(history.first().section(' ', 2));
}
void ChannelOptionsDialog::topicHistoryItemClicked(const QItemSelection&
selection)
{
- if(!selection.isEmpty())
+ if (!selection.isEmpty())
{
// update topic preview
m_ui.topicPreview->setText(m_topicModel->data(selection.indexes().first(),
Qt::UserRole).toString());
+
+ if (!m_editingTopic)
+
m_ui.topicEdit->setText(m_topicModel->data(selection.indexes().first(),
Qt::UserRole).toString());
}
else
{
// clear topic preview
m_ui.topicPreview->clear();
+
+ if (!m_editingTopic)
+ m_ui.topicEdit->clear();
}
}
@@ -480,7 +484,6 @@ namespace Konversation
QApplication::sendEvent(m_ui.banList->renameLineEdit(), &e);
}
- m_editingTopic = false;
hide();
}
diff --git a/src/irc/channeloptionsdialog.h b/src/irc/channeloptionsdialog.h
index d41debb..1dc5a57 100644
--- a/src/irc/channeloptionsdialog.h
+++ b/src/irc/channeloptionsdialog.h
@@ -64,7 +64,7 @@ namespace Konversation
protected slots:
void topicHistoryItemClicked(const QItemSelection& selection);
- void topicBeingEdited();
+ void topicBeingEdited(bool edited);
void cancelClicked();
void okClicked();
--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Konversation-devel
mailing list