[Uml-devel] KDE/kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Tue Feb 21 07:11:08 UTC 2012
SVN commit 1281297 by okellogg:
- New member m_bRenameInProgress gives better control over execution in
slotItemChanged().
- addNewItem(): Enlarge the scope of setting blockSignals(true) to cover
calls to m_editItem->set{Icon,Open}. Reason: These calls also trigger
slotItemChanged().
M +9 -3 umllistview.cpp
M +1 -0 umllistview.h
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.cpp #1281296:1281297
@@ -87,6 +87,7 @@
m_bStartedCut(false),
m_bStartedCopy(false),
m_bCreatingChildObject(false),
+ m_bRenameInProgress(false),
m_dragStartPosition(QPoint()),
m_editItem(0)
{
@@ -159,7 +160,7 @@
}
DEBUG(DBG_SRC) << "creating text: " << text;
createItem(lvitem);
- } else {
+ } else if (m_bRenameInProgress) {
DEBUG(DBG_SRC) << "text: " << text;
endRename(lvitem);
}
@@ -173,7 +174,7 @@
UMLListViewItem* currItem = static_cast<UMLListViewItem*>(currentItem());
if (currItem && currItem->isSelected()) {
DEBUG(DBG_SRC) << currItem->text(0);
- if (m_editItem) {
+ if (m_editItem && m_bRenameInProgress) {
if (m_editItem == currItem) {
// clicked on the item which is just edited
endRename(currItem);
@@ -1344,6 +1345,7 @@
m_menu = 0;
m_bStartedCut = m_bStartedCopy = false;
m_bCreatingChildObject = false;
+ m_bRenameInProgress = false;
headerItem()->setHidden(true);
}
@@ -2240,6 +2242,7 @@
parentItem = m_datatypeFolder;
}
+ blockSignals(true);
parentItem->setOpen(true);
Icon_Utils::IconType icon = Model_Utils::convert_LVT_IT(type);
@@ -2270,7 +2273,6 @@
}
m_editItem = new UMLListViewItem(parentItem, name, type, (UMLObject *)0);
}
- blockSignals(true);
m_editItem->setIcon(icon);
m_editItem->setOpen(true);
blockSignals(false);
@@ -2284,6 +2286,7 @@
bool UMLListView::itemRenamed(UMLListViewItem * item, int col)
{
DEBUG(DBG_SRC) << item->text(col);
+ m_bRenameInProgress = false;
UMLListViewItem * renamedItem = static_cast< UMLListViewItem *>(item) ;
UMLListViewItem::ListViewType type = renamedItem->type();
QString newText = renamedItem->text(col);
@@ -2790,6 +2793,7 @@
if (m_editItem) {
cancelRename(m_editItem);
}
+ m_bRenameInProgress = true;
item->startRename(0);
openPersistentEditor(item, 0);
m_editItem = item;
@@ -2804,6 +2808,7 @@
*/
void UMLListView::cancelRename(UMLListViewItem* item)
{
+ m_bRenameInProgress = false;
if (item) {
DEBUG(DBG_SRC) << item->text(0);
// delete pointer first to lock slotItemChanged
@@ -2821,6 +2826,7 @@
*/
void UMLListView::endRename(UMLListViewItem* item)
{
+ m_bRenameInProgress = false;
if (item) {
DEBUG(DBG_SRC) << item->text(0);
// delete pointer first to lock slotItemChanged
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.h #1281296:1281297
@@ -203,6 +203,7 @@
bool m_bStartedCut;
bool m_bStartedCopy;
bool m_bCreatingChildObject; ///< when creating an attribute or an operation to stop it adding a second listViewItem
+ bool m_bRenameInProgress;
QPoint m_dragStartPosition;
UMLListViewItem* m_editItem;
};
More information about the umbrello-devel
mailing list