[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/nepomuk/ui
From: Peter Penz <peter.penz19 () gmail ! com>
Date: 2010-10-31 14:19:29
Message-ID: 20101031141929.83A74AC89B () svn ! kde ! org
[Download RAW message or body]
SVN commit 1191576 by ppenz:
Remove the autofilter-code from commit 1162154:
- It does not work correctly (e.g. it filters also the temporary new item)
- It breaks the original intentation of line-editor to create items in an easy way.
Instead the behavior has been improved that a tag that is already available gets \
automatically selected if it matches to the text in the editor.
M +14 -19 kedittagsdialog.cpp
M +1 -0 kedittagsdialog_p.h
--- trunk/KDE/kdelibs/nepomuk/ui/kedittagsdialog.cpp #1191575:1191576
@@ -39,6 +39,7 @@
m_tags(tags),
m_tagsList(0),
m_newTagItem(0),
+ m_autoCheckedItem(0),
m_deleteCandidate(0),
m_newTagEdit(0),
m_deleteButtonTimer(0)
@@ -151,36 +152,24 @@
const QString tagText = text.simplified();
if (tagText.isEmpty()) {
removeNewTagItem();
-
- for (int j = 0; j < m_tagsList->count(); j++)
- {
- QListWidgetItem *entry = m_tagsList->item(j);
- entry->setHidden(false);
- }
-
return;
}
- QSet<QListWidgetItem*> matchedEntries = m_tagsList->findItems(tagText, \
Qt::MatchContains).toSet();
- for (int j = 0; j < m_tagsList->count(); j++)
- {
- QListWidgetItem *entry = m_tagsList->item(j);
- if(matchedEntries.contains(entry))
- entry->setHidden(false);
- else
- entry->setHidden(true);
- }
-
-
// Check whether the new tag already exists. If this
// is the case, remove the new tag item.
const int count = m_tagsList->count();
for (int i = 0; i < count; ++i) {
- const QListWidgetItem* item = m_tagsList->item(i);
+ QListWidgetItem* item = m_tagsList->item(i);
const bool remove = (item->text() == tagText) &&
((m_newTagItem == 0) || (m_newTagItem != item));
if (remove) {
m_tagsList->scrollToItem(item);
+ if (item->checkState() == Qt::Unchecked) {
+ item->setCheckState(Qt::Checked);
+ // Remember the checked item, so that it can be unchecked
+ // again if the user changes the tag-text.
+ m_autoCheckedItem = item;
+ }
removeNewTagItem();
return;
}
@@ -192,6 +181,12 @@
} else {
m_newTagItem->setText(tagText);
}
+
+ if (m_autoCheckedItem != 0) {
+ m_autoCheckedItem->setCheckState(Qt::Unchecked);
+ m_autoCheckedItem = 0;
+ }
+
m_newTagItem->setData(Qt::UserRole, tagText);
m_newTagItem->setCheckState(Qt::Checked);
m_tagsList->scrollToItem(m_newTagItem);
--- trunk/KDE/kdelibs/nepomuk/ui/kedittagsdialog_p.h #1191575:1191576
@@ -68,6 +68,7 @@
QList<Nepomuk::Tag> m_tags;
QListWidget* m_tagsList;
QListWidgetItem* m_newTagItem;
+ QListWidgetItem* m_autoCheckedItem;
QListWidgetItem* m_deleteCandidate;
KLineEdit* m_newTagEdit;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic